<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/7/12
  Time: 19:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script type="text/javascript" src="JS/jquery-1.8.3.js"></script>
    <script src="CSS/bootstrap.min.js"></script>
    <link rel="stylesheet" href="CSS/bootstrap.css">
</head>
<body>


<form role="form" action="ReplyTopicServlet" method="post">

    <div class="form-group">
        <label for="exampleInputEmail3">主贴编号</label>
        <input type="text" readonly="readonly" class="form-control" name="pId" id="exampleInputEmail3"
               value="${requestScope.pId}" placeholder="请输入板块编号">
    </div>

    <div class="form-group">
        <label for="exampleInputEmail4">主贴标题</label>
        <input type="text" readonly="readonly" class="form-control" name="title" id="exampleInputEmail4"
               value="${requestScope.title}" placeholder="请输入发贴标题">
    </div>

    <label for="exampleInputEmail2">回帖内容</label>
    <textarea class="form-control" id="exampleInputEmail2" rows="3" name="context" placeholder="请输入回帖内容,最大50字"></textarea>
    <button type="submit" class="btn btn-default">提交</button>
    <a href="javascript:history.go(-2)" class="btn btn-default">返回上一级</a><span id="msg">${requestScope.result}</span><span id="result"></span>
</form>


</body>
<script>
    $(function () {
        $("#exampleInputEmail2").click(function () {
            $("#msg").hide();
        });

        $("#exampleInputEmail2").keyup(function () {
            var $len = $("#exampleInputEmail2").val();
            var codlen = 50 - $len.length;
            if (codlen >= 0){
                $("#result").text("还剩:" + codlen + "字");
            }else {
                $("#result").text("字数已超上限!!");
                $("#result").css("color","red");
            }
            if ($len.length > 50) {
                $("#exampleInputEmail2").attr("readOnly", true);
            }
        });

    })

</script>

</html>
